package com.demonzym.gtv.api;

import com.demonzym.framework.net.http.HttpEngine;
import com.demonzym.framework.net.http.HttpListener;
import com.demonzym.framework.net.http.HttpRequest;
import com.demonzym.framework.net.http.HttpListener.IHttpListener;

public class Api implements IApi {
	
	private static Api mInstance;
	
	public static Api getInstatnce(){
		if(mInstance == null){
			mInstance = new Api();
		}
		return mInstance;
	}
	
	private Api(){
		
	}
	
	//Data
	private String mServer;
	
	public String getServer(){
		return mServer;
	}
	
	public void setServer(String server){
		mServer = server;
	}

	public int getChannelList(IHttpListener l) {
		// TODO Auto-generated method stub
		HttpRequest request = new HttpRequest(URL_GET_CHANNEL_LIST);
		HttpListener.getInstance().addHttpListener(request.getRequestID(), l);
		request.setHttpCallBack(HttpListener.getInstance());
		HttpEngine.getInstance().addRequest(request);
		return request.getRequestID();
	}

	public int getProgramTimeline(String url, IHttpListener l) {
		// TODO Auto-generated method stub
		HttpRequest request = new HttpRequest(url);
		HttpListener.getInstance().addHttpListener(request.getRequestID(), l);
		request.setHttpCallBack(HttpListener.getInstance());
		HttpEngine.getInstance().addRequest(request);
		return request.getRequestID();
	}
	

}
